<html>
	<head>
		<title>桥接模式</title>
		<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
		<script>
			/*需要装饰的类（函数）*/
			function Macbook() {
				this.cost = function() {
					return 1000;
				};
			}

			function Memory(macbook) {
				this.cost = function() {
					return macbook.cost() + 75;
				};
			}

			function BlurayDrive(macbook) {
				this.cost = function() {
					return macbook.cost() + 300;
				};
			}

			function Insurance(macbook) {
				this.cost = function() {
					return macbook.cost() + 250;
				};
			}

			// 用法
			var myMacbook = new Insurance(new BlurayDrive(new Memory(new Macbook())));
			console.log(myMacbook.cost());
		</script>
	</head>
	<body></body>
</html>